const app = getApp()
Page({

  data: {
    store:[],
    config:{}
  },
  	onShow: function (){
    this.setData({
      config:app.globalData.appConfig
    })
    app.loginState(()=>{
      if(app.globalData.appConfig.store.is_store == 1){
        this.storeApi();
      }
		},true)
	},
  //下拉刷新
  onPullDownRefresh: function () {
    wx.showNavigationBarLoading();
    setTimeout(()=>{
      wx.hideNavigationBarLoading();
      wx.stopPullDownRefresh();
    },1500);
    this.setData({
      loading: true,
      page:0,
      coupon:[]
    });
    this.storeApi();
  },
  //读取优惠券
  storeApi: function () {
    app.api().Get('api/v1/ais/gmstore/statis',(result) => {
      this.setData({
        store:  result.data,
      });
    })
  }
})